<include file="Public/head"/>
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.css" />
<script src="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<style type="text/css">
    .select_model{
        -moz-appearance: none;background: rgba(0, 0, 0, 0) url("{:get_style_cdnurl()}paimai/yunying/images/sanjiao.jpg") no-repeat scroll 115px 5px;
        border: 1px solid #d7d7d7;
        float: left;height: 26px;line-height: 26px;margin-right: 8px;text-indent: 2px;width: 136px;}
    .select2-container .select2-choice{ background: #fff url("{:get_style_cdnurl()}paimai/yunying/images/sanjiao.jpg") no-repeat scroll 132px 5px;width: 140px;}
</style>
<include file="Public/common_header"/>
<div class="mian">
    <include file="Public/sidebar" menu="rzgl.csqyrz"/>
    <div class="mianR">
        <div class="yuyue">
            <ul>
                <li onclick="get_list(1);" class="yuCurrent">认证审核</li>
                <li onclick="get_list(2);">待签约</li>
                <li onclick="get_list(3);">签约跟踪</li>
                <li onclick="get_list(4);">签约成功</li>
                <li onclick="get_list(5);">签约失败</li>
                <li onclick="get_list(6);">认证失败</li>
            </ul>
        </div>

        <div class="yuList">
            <div class="yuSuo clearfix" style="float:left;">
                <input id="status" name="status" type="hidden" value="{$params.status|default=1}"/>
                <input type="text" id="dealer_id" name="dealer_id" placeholder="请输入车商ID" value="" class="suoDian" />
                <input type="text" id="company_name" name="company_name" placeholder="请输入公司名称" value="" class="suoDian" />
                <input type="text" id="business_license_num" name="business_license_num" placeholder="请输入营业执照号" value="" class="suoDian" />
                <input type="text" id="auth_name" name="auth_name" placeholder="请输入授权人姓名" value="" class="suoDian" />
                <input type="text" id="auth_phone" name="auth_phone" placeholder="请输入授权人手机号" value="" class="suoDian" /><br/><br/>
                <input type="text" id="start_time" name="start_time" value="" readonly placeholder="注册开始时间" style="margin-left: 10px;"/><em></em>
                <input type="text" id="end_time" name="end_time" value="" readonly placeholder="注册结束时间" style="margin-right: 10px;"/>
                <input type="button" id="search" value="搜索" class="suoSou">
            </div>

            <div class="listBox" id="listBox">

            </div>
        </div>
        <div class="clear"></div>
    </div>
</div>
<script type="text/javascript">
    $("#start_time").ymdateplugin({
        changeMonth: true,
        changeYear: true
    });
    $("#end_time").ymdateplugin({
        changeMonth: true,
        changeYear: true
    });

    function get_page(p){
        var status = $("#status").val();
        var url = get_url();
        url += "&p=" + p;
        $.get("/CarDealerCompanyCertify/company_certify_list?status=" + status, encodeURI(url), function(data){
            $("#listBox").html(data);
        },"html");
    }
    get_list(1);
    function get_list(status){
        change_tabs(status);
        $("#status").val(status);
        var url = get_url();
        $.get("/CarDealerCompanyCertify/company_certify_list?status=" + status ,url,function(data){
            $("#listBox").html(data);
        },"html");
    }
    function get_url(){
        var url = "";
        var location_area = $("#location_area").val();
        var dealer_id = $("#dealer_id").val();
        var company_name = $("#company_name").val();
        var business_license_num = $("#business_license_num").val();
        var auth_name = $("#auth_name").val();
        var auth_phone = $("#auth_phone").val();
        var start_time = $("#start_time").val();
        var end_time = $("#end_time").val();
        if (location_area > 0) {
            url += '&location_area=' + location_area;
        }
        if (dealer_id) {
            url += '&dealer_id=' + dealer_id;
        }
        if (company_name) {
            url += '&company_name=' + company_name;
        }
        if (business_license_num) {
            url += '&business_license_num=' + business_license_num;
        }
        if (auth_name) {
            url += '&auth_name=' + auth_name;
        }
        if (auth_phone) {
            url += '&auth_phone=' + auth_phone;
        }
        if (start_time) {
            url += '&start_time=' + start_time;
        }
        if (end_time) {
            url += '&end_time=' + end_time;
        }
        return url;
    }

    $('#search').on('click',function(){
        var status = $("#status").val();
        get_list(status);
        // clear_params();
    });
    function change_tabs(status){
        if(status == 1){
            var start_placeholder = '申请开始时间';
            var end_placeholder = '申请结束时间';
        }else if(status == 2){
            var start_placeholder = '认证开始时间';
            var end_placeholder = '认证结束时间';
        }else if(status == 3){
            var start_placeholder = '跟踪开始时间';
            var end_placeholder = '跟踪结束时间';
        }else if(status == 4){
            var start_placeholder = '签约开始时间';
            var end_placeholder = '签约结束时间';
        }else if(status == 5){
            var start_placeholder = '失败开始时间';
            var end_placeholder = '失败结束时间';
        }else if(status == 6){
            var start_placeholder = '驳回开始时间';
            var end_placeholder = '驳回结束时间';
        }
        $("#start_time").attr('placeholder',start_placeholder);
        $("#end_time").attr('placeholder',end_placeholder);
        if($("#status").val() != status){
            clear_form_params();
        }
    }
    function clear_form_params(){
        $(':input').not(':button, :submit, :reset, :hidden, select').val('');
        if($("#location_area option").length > 1){
            $("#location_area").val(0);
        }
    }
</script>
<include file="Public/foot"/>